home *** CD-ROM | disk | FTP | other *** search
/ 600 Games / 600games.iso / Aventura / TheBearsAdventure.swf / scripts / frame_6 / PlaceObject2_1491_269 / CLIPACTIONRECORD onClipEvent(enterFrame).as next >
Encoding:
Text File  |  2005-08-04  |  1.8 KB  |  52 lines

  1. onClipEvent(enterFrame){
  2.    if(_visible)
  3.    {
  4.       dx = _level0.hero._x - _X;
  5.       dy = _level0.hero._y - _Y;
  6.       if(sost == 0)
  7.       {
  8.          dlen = Math.sqrt(dx * dx + dy * dy);
  9.          dx *= (speed + _level0.monster_clock1.ghost_count * 2) / dlen;
  10.          dy *= (speed + _level0.monster_clock1.ghost_count * 2) / dlen;
  11.          var found = false;
  12.          i = 1;
  13.          while(i <= _level0.monster_clock1.ghost_count)
  14.          {
  15.             if("/monster_ghost" + i != _target)
  16.             {
  17.                if(_X + dx + 15 >= eval("_level0.monster_ghost" + i)._x - 15 && _X + dx - 15 <= eval("_level0.monster_ghost" + i)._x + 15 && (_Y + dy + 12 >= eval("_level0.monster_ghost" + i)._y - 12 && _Y + dy - 12 <= eval("_level0.monster_ghost" + i)._y + 12))
  18.                {
  19.                   found = true;
  20.                   break;
  21.                }
  22.             }
  23.             i++;
  24.          }
  25.          if(!found)
  26.          {
  27.             _X = _X + dx;
  28.             _Y = _Y + dy;
  29.          }
  30.       }
  31.       else
  32.       {
  33.          dx = _level0.hero._x - _X;
  34.          dy = _level0.hero._y - _Y;
  35.          dlen = Math.sqrt(dx * dx + dy * dy);
  36.          _X = _X - dx * 16 / dlen;
  37.          _Y = _Y - dy * 16 / dlen;
  38.          if(_X < 0 || _X > 800 || (_Y < 0 || _Y > 560))
  39.          {
  40.             this.removeMovieClip();
  41.          }
  42.       }
  43.       if(sost == 0 && !_level0.hero.immortal && (_level0.hero.sost == 1 || _level0.hero.sost == 2 || _level0.hero.sost == 3) && (_X + 15 >= _level0.hero._x - 27 && _X - 15 <= _level0.hero._x + 25) && (_Y + 12 >= _level0.hero._y - 8 && _Y - 12 <= _level0.hero._y + 28))
  44.       {
  45.          _level0.hero.sost = 9;
  46.          _level0.hero.death_index = 0;
  47.          _level0.hero._xscale = _xscale;
  48.          _level0.hero.gotoAndPlay(_level0.hero.frame_death);
  49.       }
  50.    }
  51. }
  52.